from time import sleep
from framework.Function.ModbusBasicFunction.function import *


# 工序模拟信号关闭
def simulate_signal_off(process_num):
    process_simu_signal_off(process_num)


# 工序模拟信号开启
def simulate_signal_on(process_num):
    process_simu_signal_on(process_num)


# 工序屏蔽
def Process_Shield(process_num):
    process_shield(process_num)


# 工序取消屏蔽
def Process_UnShield(process_num):
    process_shield_off(process_num)


# 拥堵小车数量
def jam_car_count():
    # 以下为验证逻辑
    sleep(10)
    car_count = read_car_num()
    i = 1
    flag = 0
    while i <= car_count:
        if read_reg_IntOrBool(40001 + ((i - 1) * 40)) == 1:
            flag = flag + 1
        i = i + 1
    return flag


# 设置工序号为process_num的运动到第一目标的速度speed 浮点数
def Set_process_speed(process_num, speed):
    set_process_speed(process_num, speed)


# 设置工序号为process_num的运动到第一目标的加速度acc 浮点数
def Set_process_acc(process_num, acc):
    set_process_acc(process_num, acc)
